﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ERP.Data;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ERP.Data.Cate cate = new ERP.Data.Cate();


        private void Form1_Load(object sender, EventArgs e)
        {
            
            var dt = cate.loadDSDVTAll();
            textBox1.Text = dt.Rows.Count.ToString();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            var dv = new Dm_Donvitinh();
            dv.MaDonvitinh = "test";
            dv.TenDonvitinh = "test";
            cate.AddDVT(dv);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            var dt = cate.loadDVTById(long.Parse(textBox1.Text));
            dt.TenDonvitinh = textBox1.Text;

            cate.UpdateDVT(dt);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            var dt = cate.loadDVTById(long.Parse(textBox1.Text));
            cate.DelDVT(dt);
        }


    }
}
